#!/usr/bin/env python

#求水仙花数（各位数的立方和等于改数本身）

def sxh(num) :
    sum = 0
    i = num
    while i > 0 :
        a = i%10
        sum += a**3
        i //= 10
    if sum == num :
        return True
    return False

def amount_sxh(s) :
    sum = 0
    for m in range(1, s+1, 1) :
        if sxh(m) : 
            print(m)
            sum += 1
    print("一共有" + str(sum) + "个水仙数")


a = int(input("请输入一个数："))
amount_sxh(a)

